package com.hh.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hh.pojo.Total;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TotalMapper extends BaseMapper<Total> {
    //根据温湿度传感器查询
    @Select("SELECT * FROM total WHERE sensorType ='温湿度传感器'")
    List<Total> queryTemp();
    //根据传感器类型或者起始时间 查询湿度
    @Select("SELECT * FROM total WHERE sensorType = '光照度传感器'")
    List<Total> queryLight();
    //查询整张表
    @Select("select * from total ")
    List<Total> queryAll();
    //从硬件读取的信息存储到数据库中
    @Insert("insert into total (temperature,humidity,light,sensorType,startTime) values (#{temperature},#{humidity},#{light},#{sensorType},#{startTime})")
    int SaveTotal(Total total);
}
